package org.common4j2ee.s2shs.web.security;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AbstractAuthenticationTargetUrlRequestHandler;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;


public class UserLogoutInterceptor  extends AbstractAuthenticationTargetUrlRequestHandler implements LogoutSuccessHandler {
	private static final Logger logger = LoggerFactory.getLogger(UserLogoutInterceptor.class);
	
	public void onLogoutSuccess(HttpServletRequest request,
			HttpServletResponse response, Authentication authentication)
			throws IOException, ServletException {
		if (logger.isDebugEnabled()) {  
            logger.debug(authentication.getName()+"logout success"); 
        } 
		super.handle(request, response, authentication);
	}
}
